package com.excel.controller;

import java.io.FileNotFoundException;
import java.io.IOException;

import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.utils.JsonResult;
import com.excel.service.*;

/**
 * @Title: ExcelExportController.java
 * @Package com.excel.controller
 * @author 孙梦楠
 * @date 2017年11月5日 下午3:18:50
 * @version V1.0.0
 */
@RestController
@RequestMapping("/export")
public class ExcelExportController {

	@Autowired
	private ExcelExportService excelexportservice;

	@Autowired
	private UploadDownloadService downloadservice;

	@RequestMapping(value = "/temp", method = RequestMethod.GET)
	public JsonResult<String> export(HttpServletResponse response) throws FileNotFoundException, IOException {
		
		JsonResult<String> json= excelexportservice.exportRecordreport();
		String filename=json.getData();
		
		return downloadservice.downLoad(response,filename);
	}

}
